package com.example.config;

import com.example.utils.LoginIntercepter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Component
public class SpringMvcConfig implements WebMvcConfigurer {

    @Autowired
    LoginIntercepter loginIntercepter;

    @Override
    public void addInterceptors(final InterceptorRegistry registry) {
        registry.addInterceptor(loginIntercepter)
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/user/login",
                        "/ebookList",
                        "/categoryList",
                        "/docList/**",
                        "/docContent/**",
                        "/doc/vote/**",
                        "/ebookStatistic",
                        "/ebook30DayStatistic"
                );
    }
}
